# _*_ coding: utf-8 _*_

from odoo import models, api
from odoo.tools.translate import _
from odoo.exceptions import UserError


class PurchaseOrder(models.Model):
    _inherit = "purchase.order"

    @api.multi
    def button_confirm(self):
        for order in self:
            if order.partner_id.is_a_temporary_vendor:
                raise UserError(_("You can't confirm a purchase order with a temporary vendor!"))
        return super(PurchaseOrder, self).button_confirm()
